<template>
  <div class="navbar">
    <el-row>
      <el-col :span="6" class="navbar-content">
        <div class="logo">
          <img src="../../../assets/img/logo.png" alt="五舟科技股份有限公司" />
        </div>
      </el-col>
      <el-col :span="16" class="navbar-content">
        <div>
          <el-menu :default-active="activeIndex" class="el-menu-demo" mode="horizontal">
            <el-menu-item index="1" style="padding:0;">
              <router-link tag="div" to="/user/index" style="padding:0 20px;">首页</router-link>
            </el-menu-item>
            <el-submenu index="2" :hide-timeout="0" :show-timeout="0">
              <template slot="title">产品中心</template>
              <el-menu-item index="2-1">
                <productcenter></productcenter>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="3" :hide-timeout="0" :show-timeout="0">
              <template slot="title">解决方案</template>
              <el-menu-item index="3-1">
                <defaultnavbarcontainer></defaultnavbarcontainer>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="4" :hide-timeout="0" :show-timeout="0">
              <template slot="title">成功案例</template>
              <el-menu-item index="4-1">
                <defaultnavbarcontainer></defaultnavbarcontainer>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="5" :hide-timeout="0" :show-timeout="0">
              <template slot="title">新闻中心</template>
              <el-menu-item index="5-1">
                <defaultnavbarcontainer></defaultnavbarcontainer>
              </el-menu-item>
            </el-submenu>
            <el-submenu index="6" :hide-timeout="0" :show-timeout="0">
              <template slot="title">关于五舟</template>
              <el-menu-item index="6-1">
                <defaultnavbarcontainer></defaultnavbarcontainer>
              </el-menu-item>
            </el-submenu>
          </el-menu>
        </div>
      </el-col>
      <el-col :span="2" class="navbar-content" style="position: relative;">
        <div class="search-button">
          <el-button
            icon="el-icon-search"
            circle
            style="background-color:#fff!important;"
            @click="handleToggleButton"
          ></el-button>
        </div>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import ProductCenter from './NavbarContainer/ProductCenter'
import DefaultNavbarContainer from './NavbarContainer/DefaultNavbarContainer'
export default {
  data() {
    return {}
  },
  methods: {
    handleToggleButton() {
      this.$emit('toHandleToggleButton')
    }
  },
  components: {
    productcenter: ProductCenter,
    defaultnavbarcontainer: DefaultNavbarContainer
  },
  props: ['activeIndex']
}
</script>

<style lang="less" scope>
.navbar {
  a {
    color: #303133;
    text-decoration: none;
  }
  .navbar-content {
    height: 60px;
    background-color: #fff;
    border-bottom: solid 1px #e6e6e6;
    box-sizing: content-box;
    overflow: hidden;
  }
  .logo {
    height: 60px;
    box-sizing: border-box;
    padding: 5px;
    img {
      height: 100%;
      display: block;
      background-color: #409eff;
      border-radius: 5px;
      padding: 5px;
      box-sizing: border-box;
    }
  }
  .search-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
  }
}
body {
  .el-menu--horizontal {
    width: 100%;
    left: 0px !important;
    .el-menu {
      padding: 0;
      box-shadow: none;
      margin-top: 2px;
      background-color: transparent;
      .el-menu-item {
        height: 0;
      }
    }
  }
}
</style>
